// function Employee(name, age) {
//     this.name = name
//     this.age = age
// }
//
// Employee.prototype.toString = function () {
//     return `name: ${this.name}, age: ${this.age}`
// }
//
// const employee1 = new Employee('张三', 18)
// console.log("=>(index.js:7) employee1", employee1);
// //=>(index.js:7) employee1 Employee { name: '张三', age: 18 }
// console.log(employee1.toString())
// // name: 张三, age: 18

class Employee {
    constructor(name, age) {
        this.name = name;
        this.age = age;
    }

    toString() {
        return `name: ${this.name}, age: ${this.age}`
    }
}
const employee1 = new Employee('张三', 18)
console.log("=>(index.js:7) employee1", employee1);
//=>(index.js:7) employee1 Employee { name: '张三', age: 18 }
console.log(employee1.toString())
// name: 张三, age: 18